package com.sutuijingling.a;

import android.graphics.Rect;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import com.android.uiautomator.core.UiDevice;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiScrollable;
import com.android.uiautomator.core.UiSelector;
import com.sutuijingling.bean.AccountBean;
import com.sutuijingling.result.c;
import com.sutuijingling.result.d;

public class h extends e {
    static String[] a = new String[]{"描述相符", "发货速度", "服务态度"};

    public h(d dVar, UiDevice uiDevice) {
        this.commentParams = dVar;
        this.device = uiDevice;
    }

    public void a() {
        try {
            b();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void a(AccountBean accountBean) throws UiObjectNotFoundException, c {
        UiObject findAllObjText = findAllObjText(new UiSelector().scrollable(true), new UiSelector().resourceId("com.taobao.taobao:id/clrv_orderList"), new UiSelector().className(RelativeLayout.class), this.commentParams.a());
        debugUiObject(findAllObjText);
        System.out.println(" exist layout for wangwang[" + this.commentParams.a() + "] :" + findAllObjText.exists());
        findAllObjText = findAllObjText.getChild(new UiSelector().className(Button.class).text("确认收货"));
        ensureExist(findAllObjText, " 怎么确认收获的 按钮找不到了????");
        com.sutuijingling.utils.c.d(findAllObjText);
        findAllObjText = com.sutuijingling.utils.c.a("com.taobao.taobao:id/mini_input_et_password");
        ensureExist(findAllObjText, " 没有输入 支付密码的小框框???");
        ensureInput(findAllObjText, accountBean.getRealPaycode());
        findAllObjText = new UiObject(new UiSelector().className(Button.class).text("确定"));
        System.out.println(" ensure pay code confirm enable :" + findAllObjText.isEnabled());
        ensureExist(findAllObjText, "  确认密码输完了?怎么确定没有.... ");
        debugUiObject(findAllObjText);
    }

    public void b() throws UiObjectNotFoundException {
        UiObject childByText = new UiScrollable(new UiSelector().className(ScrollView.class)).getChildByText(new UiSelector().className(RelativeLayout.class), "发货速度", true);
        debugUiObject(childByText);
        debugChildren(childByText);
        Rect bounds = childByText.getChild(new UiSelector().className(ImageView.class)).getBounds();
        com.sutuijingling.utils.c.a(this.device, bounds.left + (((bounds.right - bounds.left) * 4) / 5), ((bounds.bottom - bounds.top) / 2) + bounds.top);
    }
}
